package org.terrier.applications;

import org.terrier.utility.ApplicationSetup;

public class TRECQueryingHK extends TRECQuerying {
public String processQuerieshk(double c, boolean c_set, String methodName) {
		
		matchingCount = 0;
		querySource.reset();
		this.startingBatchOfQueries();
		final long startTime = System.currentTimeMillis();
		boolean doneSomeMethods = false;
		boolean doneSomeTopics = false;
					wModel = methodName;
					// iterating through the queries
					while (querySource.hasNext()) {
						String query = querySource.next();
						String qid = querySource.getQueryId();
						// process the query
						long processingStart = System.currentTimeMillis();
						processQueryAndWrite(qid, query, c, c_set);
						long processingEnd = System.currentTimeMillis();
						if (logger.isInfoEnabled())
							logger
									.info("Time to process query: "
											+ ((processingEnd - processingStart) / 1000.0D));
						doneSomeTopics = true;
					}
					querySource.reset();
					this.finishedQueries();
					// after finishing with a batch of queries, close the result
					// file
					doneSomeMethods = true;
					if (DUMP_SETTINGS && doneSomeTopics)
						printSettings(
								queryingManager.newSearchRequest(""),
								querySource.getInfo(),
								String
										.format(
												"# run started at: %d\n# run finished at %d\n# c=%f c_set=%b\n# model=%s\n",
												startTime, System
														.currentTimeMillis(),
												c, c_set, wModel));
		if (!doneSomeTopics)
			logger.error("No queries were processed. Please check the file "
					+ ApplicationSetup.TREC_TOPICS_LIST);
		if (!doneSomeMethods)
			logger.error("No models were specified. Please check the file "
					+ ApplicationSetup.TREC_MODELS);
		if (doneSomeTopics && doneSomeMethods)
			logger.info("Finished topics, executed " + matchingCount
					+ " queries in "
					+ ((System.currentTimeMillis() - startTime) / 1000.0d)
					+ " seconds, results written to " + resultsFilename);
		return resultsFilename;
	}
}
